import request from '@/utils/request'

export default {

  addRace: (data) => {
    return request({
      url: '/race/new',
      method: 'post',
      data
    })
  },

  addRaceLH: (data) => {
    return request({
      url: '/race/new/lh',
      method: 'post',
      data
    })
  },

  updateRace: (data) => {
    return request({
      url: '/race/update',
      method: 'post',
      data
    })
  },

  updateRaceLH: (data) => {
    return request({
      url: '/race/update/lh',
      method: 'post',
      data
    })
  },

  /**
   * 变更上报方式
   */
  updateReport: (data) => {
    return request({
      url: '/race/update/report',
      method: 'post',
      data: data
    })
  },

  deleteResult: (data) => {
    return request({
      url: '/race/delete/result',
      method: 'post',
      data
    })
  },

  listRaces: (data) => {
    return request({
      url: '/race/list',
      method: 'post',
      data
    })
  },

  resumeRace: (data) => {
    return request({
      url: '/race/resume',
      method: 'post',
      data
    })
  },

  resumeRaceLH: (data) => {
    return request({
      url: '/race/resume/lh',
      method: 'post',
      data
    })
  },

  stopRace: (data) => {
    return request({
      url: '/race/stop',
      method: 'post',
      data
    })
  },

  cloneRace: (data) => {
    return request({
      url: '/race/clone',
      method: 'post',
      data
    })
  },

  detailRace: (data) => {
    return request({
      url: '/race/detail',
      method: 'post',
      data
    })
  },

  // 下载
  download: (data) => {
    return request({
      url: '/race/download?id='+data.id,
      method: 'get',
      responseType:'blob',
    })
  }

}
